package com.csjbot.blackgaga.feature.settings.charge_setting;

import android.content.Context;
import android.content.Intent;

/**
 * author : chenqi.
 * e_mail : 1650699704@163.com.
 * create_time : 09/11/2017.
 */

public class ChargeManager {
    public static ChargeManager charge = null;

    /**
     * 默认检测电量
     */
    public static int charging = 20;

    /**
     * 上下文
     */
    private static Context mContext;

    public ChargeManager() {
    }

    /**
     * 静态工厂
     *
     * @param context
     * @return
     */
    public static ChargeManager getIntanse(Context context) {
        mContext = context;
        if (charge == null) {
            synchronized (ChargeManager.class) {
                charge = new ChargeManager();
                return charge;
            }
        } else {
            return charge;
        }
    }

    /**
     * 发送广播 显示电量低
     */
    public void gohome() {
        Intent intent = new Intent("com.example.BROADCAST");
        mContext.sendBroadcast(intent);
    }

    public void closeDialog() {
        Intent intent = new Intent("com.example.broadcast.FORCE_EXIT");
        mContext.sendBroadcast(intent);
    }

}
